<?php
/**
 * 邀请返利API验证器
 * @author 王勇程 <laughskydragon@qq.com>
 */

namespace app\api\validate;

use think\Validate;

class Invite extends Validate
{
    protected $rule = [
        'user_token' => 'require',
        'invite_code' => 'require|alphaNum|length:6,10',
        'amount' => 'require|float|gt:0',
        'withdraw_type' => 'require|in:wechat,alipay,bank',
        'account_info' => 'require',
        'page' => 'integer|egt:1',
        'limit' => 'integer|between:1,100'
    ];
    
    protected $message = [
        'user_token.require' => '用户token不能为空',
        'invite_code.require' => '邀请码不能为空',
        'invite_code.alphaNum' => '邀请码只能包含字母和数字',
        'invite_code.length' => '邀请码长度必须在6-10位之间',
        'amount.require' => '提现金额不能为空',
        'amount.float' => '提现金额必须为数字',
        'amount.gt' => '提现金额必须大于0',
        'withdraw_type.require' => '提现方式不能为空',
        'withdraw_type.in' => '提现方式只能是微信、支付宝或银行卡',
        'account_info.require' => '账户信息不能为空',
        'page.integer' => '页码必须为整数',
        'page.egt' => '页码必须大于等于1',
        'limit.integer' => '每页数量必须为整数',
        'limit.between' => '每页数量必须在1-100之间'
    ];
    
    protected $scene = [
        'process' => ['user_token', 'invite_code'],
        'withdraw' => ['user_token', 'amount', 'withdraw_type', 'account_info']
    ];
}